import Vue from 'vue';
const prefix = "/health-box-api/v1/results";

/**
 * 普通用户查看核酸检测结果
 * request: {}
 */
 export const userHospitalResults = () => {
  return Vue.$http({
    url: prefix + '/user/hospitalResult',
    method: 'get'
  });
};

/**
 * 普通用户查看公告
 * request: {
 *  "hospital_id": 1 // 检测机构id
 * }
 */
 export const userHospitalNotices = (data) => {
  return Vue.$http({
    url: prefix + '/user/hospitalNotice',
    method: 'post',
    data: {
      hospital_id: data.hospital_id
    }
  });
};

/**
 * 普通用户查看检测机构
 * request: {}
 */
 export const userHospitalRegions = () => {
  return Vue.$http({
    url: prefix + '/user/hospitalRegion',
    method: 'get'
  });
};

/**
 * 检测机构管理员增加核酸检测结果
 * request: {
 *  "ai_id": 1, // 预约id
 *  "result": "" // 检测结果
 * }
 */
 export const TOadminResultAdd = (data) => {
  return Vue.$http({
    url: prefix + '/TOadmin/nat/create',
    method: 'post',
    data: {
      ai_id: data.ai_id,
      result: data.result
    }
  });
};

/**
 * 检测机构管理员删除核酸检测结果
 * request: {
 *  "tr_id": 1 // 检测结果id
 * }
 */
 export const TOadminResultDelete = (data) => {
  return Vue.$http({
    url: prefix + '/TOadmin/nat/delete',
    method: 'post',
    data: {
      tr_id: data.tr_id
    }
  });
};

/**
 * 检测机构管理员修改核酸检测结果
 * request: {
 *  "tr_id": 1, // 检测结果id
 *  "ai_id": 1, // 预约id
 *  "result": "" // 检测结果
 * }
 */
 export const TOadminResultUpdate = (data) => {
  return Vue.$http({
    url: prefix + '/TOadmin/nat/update',
    method: 'post',
    data: {
      tr_id: data.tr_id,
      ai_id: data.ai_id,
      result: data.result
    }
  });
};

/**
 * 检测机构管理员查看核酸检测结果
 * request: {}
 */
 export const TOadminResultCheck = () => {
  return Vue.$http({
    url: prefix + '/TOadmin/nat/retrieve',
    method: 'get'
  });
};

/**
 * 检测机构管理员增加公告
 * request: {
 *  "title": "", // 公告标题
 *  "content": "" // 公告内容
 * }
 */
 export const TOadminNoticeAdd = (data) => {
  return Vue.$http({
    url: prefix + '/TOadmin/notice/create',
    method: 'post',
    data: {
      title: data.title,
      content: data.content
    }
  });
};

/**
 * 检测机构管理员删除公告
 * request: {
 *  "noticeId": "" // 公告id
 * }
 */
 export const TOadminNoticeDelete = (data) => {
  return Vue.$http({
    url: prefix + '/TOadmin/notice/delete',
    method: 'post',
    data: {
      noticeId: data.noticeId
    }
  });
};

/**
 * 检测机构管理员修改公告
 * request: {
 *  "noticeId": "", // 公告id
 *  "title": "", // 公告标题
 *  "content": "" // 公告内容
 * }
 */
 export const TOadminNoticeUpdate = (data) => {
  return Vue.$http({
    url: prefix + '/TOadmin/notice/update',
    method: 'post',
    data: {
      noticeId: data.noticeId,
      title: data.title,
      content: data.content
    }
  });
};

/**
 * 检测机构管理员查看公告
 * request: {
 *  "noticeId": "", // 公告id
 *  "time": "", // 发布时间
 *  "title": "", // 公告标题
 *  "content": "" // 公告内容
 * }
 */
 export const TOadminNoticeCheck = () => {
  return Vue.$http({
    url: prefix + '/TOadmin/notice/retrieve',
    method: 'get'
  });
};
